package org.flow.basic.doubts.tjbase;

import java.util.stream.Stream;

/**
 * @author xl-9527
 * @since 2024/8/1
 */
public class ForEachBreak {

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            if (i == 5) {
                break;
            }
            System.out.println(i);
        }

        System.out.println("-------------------");

        Stream.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).forEach(v -> {
            if (v == 5) {
                return;
            }
            System.out.println(v);
        });
    }
}
